package com.whmskj.xjlhsc.mobie.empProPlan.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.whmskj.xjlhbc.core.Page;
import com.whmskj.xjlhsc.mobie.empProPlan.entity.ProPersonnelStand;
import com.whmskj.xjlhsc.mobie.empProPlan.mapper.ProPersonnelStandMapper;
import com.whmskj.xjlhsc.mobie.empProPlan.service.ProPersonnelStandService;
import com.whmskj.xjlhsc.utils.SCUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;
import java.util.List;

/**
 * @author lk
 * @since 2025-07-07 10:56:56
 */
@Service
@Slf4j
public class ProPersonnelStandServiceImpl extends ServiceImpl<ProPersonnelStandMapper, ProPersonnelStand> implements ProPersonnelStandService {

    @Autowired
    private ProPersonnelStandMapper proPersonnelStandMapper;

    @Override
    public List<ProPersonnelStand> findPage(ProPersonnelStand params) {
//        Page<ProPersonnelStand> page = new Page<>(1, 10);//TODO 自行处理
        Page.startPage();
        LambdaQueryWrapper<ProPersonnelStand> query = Wrappers.lambdaQuery(ProPersonnelStand.class);
        List<ProPersonnelStand> proPersonnelStands = proPersonnelStandMapper.selectList(query);
        return proPersonnelStands;
    }

    @Override
    public List<ProPersonnelStand> findList(ProPersonnelStand params){
        LambdaQueryWrapper<ProPersonnelStand> query = Wrappers.lambdaQuery(ProPersonnelStand.class);
        return proPersonnelStandMapper.selectList(query);
    }

    @Override
    public ProPersonnelStand findById(Long id) {
        return proPersonnelStandMapper.selectById(id);
    }

    @Override
    public boolean insert(ProPersonnelStand proPersonnelStand) {
        return save(proPersonnelStand);
    }

    @Override
    public boolean update(ProPersonnelStand proPersonnelStand) {
        return updateById(proPersonnelStand);
    }

    @Override
    public int delete(Long id) {
        return proPersonnelStandMapper.deleteById(id);
    }


    @Override
    public List<ProPersonnelStand> getCurrentClassPackegeEmp(SCUtil.ClassTimeRange classTimeRange) {
        return proPersonnelStandMapper.getCurrentClassPackegeEmp(classTimeRange);
    }
}